#include <iostream>

using namespace std;

int main()
{
    cout << "Welcome to DynaMoto motorcycle dynamics calculator!\nPlease choose your calculation: (NON-FUNCT)" << endl;

    char uCont('Y');

    while ((uCont=='Y')||(uCont=='y'))
    {
        double wF, wR, wFT, wRT, wheeB, rF, rR, rLH, rLW, wFR, wRR, wFRT, wRRT, wRider;
        char dRider, dScale;

        cout << "You have chosen the COM calculator.\nLet's get your raw data in:" << endl;
        cout << "Front wheel level weight (Kg): ";
        cin >> wF;
        cout << "Rear wheel level weight (Kg): ";
        cin >> wR;
        cout << "Front wheel tilted weight (Kg): ";
        cin >> wFT;
        cout << "Rear wheel tilted weight (Kg): ";
        cin >> wRT;
        cout << "Wheelbase (m): ";
        cin >> wheeB;
        cout << "Front wheel radius (m): ";
        cin >> rF;
        cout << "Rear wheel radius (m): ";
        cin >> rR;
        cout << "Rear wheel stool height (m): ";
        cin >> rLH;

        cout << "Was the stool placed on top of the scale? (Y/N): ";
        cin >> dScale;
        if ((dScale == 'Y')||(dScale == 'y'))
        {
            cout << "Weight of the stool (Kg): ";
            cin >> rLW;
        }
        else
            rLW = 0;

        double xCom, yCom, xComR, yComR;

        xCom = (wheeB*wR)/(wF+wR);
        yCom = ((wheeB*(wR-wRT+rLW))/((wF+wR)*(rLH/wheeB)))+((rF+rR)/2);

        cout << "Do you have data with a rider on the bike? (Y/N): ";
        cin >> dRider;
        if ((dRider == 'y')||(dRider == 'Y'))
        {
            cout << "Front wheel level weight with rider (Kg): ";
            cin >> wFR;
            cout << "Rear wheel level weight with rider (Kg): ";
            cin >> wRR;
            cout << "Front wheel tilted weight with rider (Kg): ";
            cin >> wFRT;
            cout << "Rear wheel tilted weight with rider (Kg): ";
            cin >> wRRT;
            cout << "Rider weight (Kg): ";
            cin >> wRider;

            xComR = (wheeB*wRR)/(wFR+wRR);
            yComR = ((wheeB*(wRR-wRRT+rLW))/((wFR+wRR)*(rLH/wheeB)))+((rF+rR)/2);
        }

        cout << "Bike center of mass is " << xCom << "m from the front axle and " << yCom << "m from the ground." << endl;
        if ((dRider == 'y')||(dRider == 'Y'))
            cout << "Bike and rider center of mass is " << xComR << "m from the front axle and " << yComR << "m from the ground." << endl;

        cout << "Would you like to make another COM calculation? (Y/N):";
        cin >> uCont;
    }
    return 0;
}